home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / iqb9109.zip / QSORT.BI < prev    next >
Text File  |  1991-09-09  |  1KB  |  36 lines

  1. '  QSort.BI
  2. '  Declarations for QuickSort data types and procedures
  3.  
  4. CONST MaxIndex = 43
  5.  
  6. '  Redefine SortType as you please. The QuickSort subprogram
  7. '  sorts on the SortType element SortKey. You can leave this
  8. '  a fixed-length string, or make it an integer, single precision, etc.
  9. '  (Any simple data type except variable-length strings).
  10.  
  11. TYPE SortType
  12.     SortKey    AS STRING*5
  13. END TYPE
  14.  
  15. '  If you have other data that is not part of the key you want
  16. '  to sort by, you can add elements to the SortType user-defined
  17. '  data type to contain that data, as you can see in the commented-out
  18. '  alternate definition of SortType below.
  19.  
  20. 'TYPE SortType
  21. '    SortKey      AS INTEGER
  22. '    CustomerName AS STRING*30
  23. 'END TYPE
  24.  
  25. '  The array below places the SortArray in a COMMON block as
  26. '  an easy way to share the array between two separate source
  27. '  modules
  28.  
  29. DIM SortArray(1 TO MaxIndex) AS SortType
  30. COMMON SHARED /QSort/ SortArray() AS SortType
  31.  
  32. '  The sorting procedures
  33. DECLARE SUB QuickSort (Low AS INTEGER, High AS INTEGER)
  34. DECLARE FUNCTION RandInt% (Lower AS INTEGER, Upper AS INTEGER)
  35.  
  36.